<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class RegisterAuthRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $action = explode('@', $this->route()->getAction()["uses"]);

        $method = $action[1].'Validation';
        return $this->$method();
    }

    /**
     * 获取应用于请求的验证规则
     *
     * @return array
     */
    public function registerValidation()
    {
        return [
            'name' => 'required|string',
            'email' => 'required|email|unique:users',
            'password' => 'required|string|min:6|max:10',
            'phone'=>'required',
        ];
    }

    /**
     * @return array
     */
    public function getAuthUserValidation()
    {
        return [
            'token' => 'required|string',
        ];
    }
}